
(function($){
	function formResult(msg, state) {
  /!*      layer.closeAll();*!/
        if(state == 0) {
            layer.alert(msg, {icon: 5});
        }else{
        	layer.alert(msg, {icon: 1});
        	parent.location.reload(true);
        }
    }
	$(function(){
		window.formResult = formResult;
        var $dec1 = '',$dec2='',$dec3='';
        $('input').on('change',function(){
            $(this).each(function(){
                var r = /^-?\d+$/ ;
                var s = /^[0-9]+\.[0-9]{0,2}$/;
                if($(this).val() !=''&&!r.test($(this).val())&&!s.test($(this).val())){
                    $(this).val("");
                }
            });
            $dec1 = $('[name="balance"]').val();
            $dec2 = $('[name="give_balance"]').val();
            $dec3 = $('[name="cash"]').val();
        });

        $('input[type="submit"]').click(function(){
            if(($dec1 == '' || $dec1 == 0) && ($dec2 == ''||$dec2 == 0) && ($dec3 == ''||$dec3 == 0)){
                layer.tips('请填写至少一种支付方式', '#layer_tips');
                return false;
            }
        })

	});
})(jQuery)
